<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ include file="international.jsp" %>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title><fmt:message key="location.title"/> - <fmt:message key="company.name"/></title>
<meta name="description" content="<fmt:message key="description.keyword"/>" />
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
</head>
<body onLoad="initialize()" onUnload="GUnload()">
<div id="msg" name="msg" style="background-color:#D4DF55; position:absolute; z-index:11; left: 10px; top: 61px; display:inline"></div>
<script>
       function Point(iX, iY){ 
          this.x = iX; 
          this.y = iY; 
       } 
 function fGetXY(obj){ 
           var oTmp = obj;     
           if(!oTmp||(typeof(oTmp.offsetLeft) == "undefined") 
               ||(typeof(oTmp.offsetTop) == "undefined") 
               ||!oTmp.tagName){ 
                return null; 
           } 
           var pt = new Point(0,0);   
           do{ 
      pt.x += oTmp.offsetLeft; 
      pt.y += oTmp.offsetTop; 
      //alert(oTmp.parentNode.tagName);
      oTmp = oTmp.parentNode; 
  } while(oTmp.tagName!="BODY"); 
  return pt; 
       } 
       
	   var gMsgTop = 0; //fGetXY(document.getElementById("tmp_pos")).y;
function show_tip(msg)
{
	if (gMsgTop == 0)
	{
		gMsgTop = fGetXY(document.getElementById("tmp_pos")).y + 5;
		document.getElementById("msg").style.top = gMsgTop;
		document.getElementById("msg").style.display = "inline";
		// alert(document.getElementById("msg").style.offsetTop);
	}
	
	document.getElementById("msg").innerHTML = msg;
}
</script>
<table width="100%" border="0" height="100%"  cellpadding="0" cellspacing="0">
<tr valign="top">
	<td>
		
<jsp:include page="top.jsp"/>
	</td>
</tr>
<tr height="3px"></tr>
<tr valign="top">
	<td align="left" height="100%" style="padding-left:8px; padding-right:8px;">
	<script charset="utf-8" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<%=com.brother.util.CommonProperties.getGoogleMapKey(request.getServerName()) %>&hl=<%=session.getAttribute("locale").toString().equals("zh")?"zh_CN":"en"%>" type="text/javascript"></script>
	<script language=javascript src="js/google_map.js"></script> 
<%
com.brother.model.Customer user = (com.brother.model.Customer)session.getAttribute(com.brother.Constants.LOGIN_SESSTION_NAME);
%>	
	<script>
var time_zone = <%=user == null ? "0":user.getTimeZoneOffSet()%>;
var g_default_time_zone_hours = parseInt(time_zone);
var g_default_time_zone_minutes = (time_zone - parseInt(time_zone)) * 60;

var g_str_comment = "";
var g_str_id = "ID:";
var g_str_lat = "Lat:";
var g_str_lng = "Lng:";
var g_str_signal = "Signal:";
var g_str_speed = "Speed:";
var g_str_state = "State:";

function get_gps_cmd_str(cmd)
{
	if (cmd == 0)
	{
		return "GPS Pos";
	}
	else if (cmd == 0x01)
	{
		return "SOS Alarm";
	}
	else if (cmd == 0x02)
	{
		return "Key 2 Alarm";
	}
	else if (cmd == 0x03)
	{
		return "Key 3 Alarm";
	}
	else if (cmd == 0x04)
	{
		return "Key 4 Alarm";
	}
	else if (cmd == 0x10)
	{
		return "Low Power Alarm";
	}
	else if (cmd == 0x11)
	{
		return "Over Speed Alarm";
	}
	else if (cmd == 0x12)
	{
		return "Position Move Alarm";
	}
	else if (cmd == 0x13)
	{
		return "Geo Fence Alarm";
	}
	else if (cmd == 0x14)
	{
		return "Reset Alarm";
	}
	else if (cmd == 0x15)
	{
		return "No GPS Signal alarm";
	}
	else if (cmd == 0x16)
	{
		return "Restore GPS Signal Alarm";
	}
	
	return "Unknown Alarm";
}
</script>
<script language=javascript src="js/gps.js"></script><script type="text/javascript">
var g_default_lat = '22.641918333';
var g_default_lng = '114.024560000';
var g_default_level = 14;
var g_default_type = G_NORMAL_MAP;
var LG_Format_Error = '<fmt:message key="location.wrong.data.format"/>';
</script>
<script language=javascript src="js/location.js"></script>	

<table width="100%" border="0" height="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td valign="top" align="left"><br /><h2><fmt:message key="location.gpsTracking"/></h2><hr size=1 color="#a9bad3">
			<table border="0" cellspacing="0" cellpadding="3" align="left" width="204">
			  <tr>
				<td colspan="2" align="left"><fmt:message key="location.pleaseEnter"/>:</td>
			  </tr>
			  <tr>
				<td width="60" align="right" nowrap="nowrap"><div align="right" style="font-weight:bold;"><fmt:message key="location.lat"/>:</div></td>
				<td >
				  <input type="text" name="lat_value" id="lat_value" value="22.641918333N" size="20" />
				</td>
			  </tr>
			  <tr>
				<td align="right"><b><fmt:message key="location.lng"/>:</b></td>
				<td ><label>
				  <input type="text" name="lon_value" id="lon_value" value="114.024560000E" size="20"/>
				</label></td>
			  </tr>
			  <tr>
				<td>&nbsp;</td>
				<td ><br /><input type="submit" name="Submit" value="<fmt:message key="location.locate"/>" onClick="javascript:setMapPosition(document.getElementById('lat_value').value, document.getElementById('lon_value').value);"/><br /><br />
				<label></label></td>
			  </tr>
			  
			  <tr>
				<td  colspan="2" valign="top" align="left"><b><fmt:message key="location.format"/>:</b></td>
				</tr>
			  <tr>
			    <td  colspan="2" valign="top" align="left"><table width="100%" border="0" cellspacing="0" cellpadding="0">

                  <tr>
                    <td width="7%"><strong>1.</strong></td>
                    <td width="93%"><table class="tableBorder1" width="130" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td>22 38 30.906000</td>
                        </tr>
                        <tr>
                          <td>114 01 28.416000</td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td><strong>2.</strong></td>
                    <td><table class="tableBorder1" width="130" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td>22.641918333</td>
                        </tr>
                        <tr>
                          <td>114.024560000</td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td><strong>3.</strong></td>
                    <td><table class="tableBorder1" width="130" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td>22.641918333N</td>
                        </tr>
                        <tr>
                          <td>114.024560000E</td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td><strong>4.</strong></td>
                    <td><table class="tableBorder1" width="130" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td>2238.5151N</td>
                        </tr>
                        <tr>
                          <td>11401.4736E</td>
                        </tr>
                    </table></td>
                  </tr>
                  
                </table></td>
		      </tr>
			  

			  <tr>
				<td colspan="2">&nbsp;</td>
			  </tr>
			  
			  <tr>
			  	<td align="right" valign="top"><b><fmt:message key="location.address"/>:</b></td>
			  	<td colspan="2">
					<div id="info_address" name="info_address"></div>				</td>
			  </tr>			  
			</table>
		 </td>
		<td align="center" width="100%" height="100%">
			<div id="map_canvas" style="position:relative; width: 100%; height: 100%" align="left">Loading...</div>
		</td>					 
	</tr>
</table>
	</td>
</tr>
<tr>
	<td colspan="3" height="20"><hr size=1 style="height:1px" color="#a9bad3">
		<table width="100%" align="center">
			<tr>
				<td align="center">
					<span style="color:#A0A0A4">Copyright &copy; 2008, All rights reserved. - <a href="mailto:">Contact us</a></span>
				</td>
			</tr>
		</table>
	</td>
</tr>
</table>
</body>
</html>
<%
com.brother.database.DataBase.closeThreadConnection();
%>